import { createI18n } from 'vue-i18n'

const messages = {
  zh: {
    // 通用
    common: {
      save: '保存',
      cancel: '取消',
      delete: '删除',
      edit: '编辑',
      add: '添加',
      search: '搜索',
      loading: '加载中...',
      confirm: '确认',
      yes: '是',
      no: '否',
      success: '成功',
      error: '错误',
      warning: '警告',
      info: '信息',
      back: '返回',
      next: '下一步',
      previous: '上一步',
      submit: '提交',
      reset: '重置',
      close: '关闭',
      open: '打开',
      view: '查看',
      download: '下载',
      upload: '上传',
      export: '导出',
      import: '导入',
      refresh: '刷新',
      logout: '退出登录',
      profile: '个人资料',
      settings: '设置',
      schoolAttendanceSystem: '学校考勤系统',
      handle: '处理',
      loadDataFailed: '加载数据失败',
      noData: '暂无数据',
      name: '名称',
      description: '描述'
    },

    // 登录
    auth: {
      login: '登录',
      username: '用户名',
      password: '密码',
      loginSuccess: '登录成功',
      loginFailed: '登录失败',
      usernameRequired: '请输入用户名',
      passwordRequired: '请输入密码',
      invalidCredentials: '用户名或密码错误',
      changePassword: '修改密码',
      currentPassword: '当前密码',
      newPassword: '新密码',
      confirmPassword: '确认密码',
      passwordChanged: '密码修改成功'
    },

    // 导航
    nav: {
      dashboard: '仪表盘',
      classManagement: '班级管理',
      studentManagement: '学生管理',
      teacherManagement: '教师管理',
      userManagement: '用户管理',
      attendanceSettings: '考勤设置',
      attendance: '考勤管理',
      reports: '报表',
      arrivalManagement: '入园管理',
      departureManagement: '离园管理',
      busManagement: '校车管理',
      afterSchoolClassManagement: '课后托班管理',

      afterSchoolArrivalManagement: '进班管理',
      afterSchoolDepartureManagement: '离班管理'
    },

    // 仪表盘
    dashboard: {
      totalStudents: '总学生数',
      presentToday: '今日到校',
      leaveToday: '今日请假',
      onLeave: '今日请假',
      abnormal: '今日异常',
      abnormalToday: '今日异常',
      attendanceRate: '出勤率',
      classAttendance: '各班出勤情况',
      recentTrends: '最近趋势',
      abnormalStudents: '异常学生',
      arrivalAbnormalStudents: '入园异常学生',
      departureAbnormalStudents: '离园异常学生',
      busStatistics: '校车统计',
      generateReport: '生成报表',
      dashboardDate: '仪表盘日期',
      startDate: '报表开始日期',
      endDate: '报表结束日期',
      headTeacher: '班主任',
      detailReport: '详细报表',
      viewDetail: '查看详情',
      arrivalStatus: '入园状态',
      arrivalTime: '入园时间',
      departureStatus: '离园状态',
      departureTime: '离园时间',
      notes: '备注'
    },

    // 班级管理
    class: {
      className: '班级名称',
      grade: '年级',
      description: '描述',
      studentCount: '学生人数',
      teachers: '任课教师',
      addClass: '添加班级',
      editClass: '编辑班级',
      deleteClass: '删除班级',
      classCreated: '班级创建成功',
      classUpdated: '班级更新成功',
      classDeleted: '班级删除成功'
    },

    // 学生管理
    student: {
      studentNo: '学号',
      studentName: '姓名',
      name: '姓名',
      qrCode: '二维码',
      parentName: '家长姓名',
      parentPhone: '家长电话',
      addStudent: '添加学生',
      editStudent: '编辑学生',
      deleteStudent: '删除学生',
      studentCreated: '学生添加成功',
      studentUpdated: '学生信息更新成功',
      studentDeleted: '学生删除成功',
      scanQRCode: '扫描二维码'
    },

    // 考勤管理
    attendance: {
      date: '日期',
      arrivalStatus: '入园状态',
      arrivalTime: '入园时间',
      departureStatus: '离园状态',
      departureTime: '离园时间',
      notes: '备注',
      present: '已到',
      leave: '请假',
      abnormal: '异常',
      notLeft: '未离园',
      bus: '校车',
      parentPickup: '家长接领',
      afterSchool: '晚托班',
      specialCourse: '特色课程',
      markArrival: '标记入园',
      markDeparture: '标记离园',
      attendanceMarked: '考勤标记成功'
    },

    // 用户管理
    user: {
      name: '姓名',
      role: '角色',
      phone: '电话',
      email: '邮箱',
      admin: '管理员',
      teacher: '教师',
      driver: '司机',
      addUser: '添加用户',
      editUser: '编辑用户',
      deleteUser: '删除用户',
      userCreated: '用户创建成功',
      userUpdated: '用户更新成功',
      userDeleted: '用户删除成功'
    },

    // 教师
    teacher: {
      welcome: '欢迎回来',
      noClassAssigned: '未分配班级',
      contactAdminForClass: '请联系管理员分配班级',
      myClassOverview: '我的班级概览',
      myTotalStudents: '我的学生总数',
      pendingTasks: '待处理任务',
      studentsNotArrived: '有 {count} 名学生尚未到校',
      payAttentionToArrival: '请关注学生到校情况',
      departureTimeArrived: '下午离校时间已到',
      markDepartureStatus: '请及时标记学生离校状态',
      abnormalStudentsCount: '有 {count} 名学生状态异常',
      checkAbnormalSituation: '请检查并处理异常情况',
      studentManagementInDevelopment: '学生管理功能开发中',
      viewAbnormalStudentDetails: '查看异常学生详情',
      dashboard: '教师仪表盘',
      arrival_management: '入园管理',
      departure_management: '离园管理',
      scan_qr: '扫描二维码',
      manual_input: '手动输入',
      student_arrived: '学生已入园',
      student_departed: '学生已离园',
      mark_departure: '标记离园',
      confirm_departure: '确认离园',
      set_abnormal: '设置异常',
      edit_notes: '编辑备注',
      quick_update: '快速更新',
      student_departure_management: '学生离园管理',
      search_student: '搜索学生',
      loading: '加载中...',
      no_student_data: '暂无学生数据',
      scan_student_qr: '扫描学生二维码',
      manual_input_code: '或手动输入学号/二维码',
      time_restriction: '时间限制',
      bus_pickup: '校车接送',
      parent_pickup: '家长接领',
      after_school: '晚托班',
      special_course: '特色课程',
      select_after_school_class: '选择课后班级',
      please_select_class: '请选择课后班级',
      student_notes: '学生备注',
      enter_notes: '请输入学生备注信息...',
      confirm_student_departure: '确认学生离校',
      confirm_student_left_class: '确认学生离班',
      mark_departure_status: '标记离园状态',
      edit_student_notes: '编辑学生备注',
      marked_time: '标记时间',
      departure_update_success: '离园状态更新成功',
      departure_update_failed: '更新离园状态失败',
      departure_confirm_success: '学生离班确认成功',
      departure_confirm_failed: '确认学生离班失败',
      quick_mark_failed: '快速标记失败',
      mark_departure_failed: '标记离园状态失败',
      get_attendance_data_failed: '获取班级考勤数据失败',
      load_after_school_classes_failed: '加载课后班级列表失败',
      not_set: '未设置'
    },

    // 司机
    driver: {
      driverWorkstation: '司机工作台',
      myBusInfo: '我的校车信息',
      driverLicense: '驾驶证号',
      busNumber: '校车编号',
      notSet: '未设置',
      notAssigned: '未分配',
      currentTime: '当前时间',
      todayBusStudents: '今日校车学生',
      pending: '待处理',
      quickOperation: '快速操作',
      busManagement: '校车管理',
      personalSettings: '个人设置',
      todayBusList: '今日校车名单',
      noBusStudentsToday: '今日暂无校车学生',
      departureMarkedByTeacher: '学生离园状态由教师标记',
      viewAllStudents: '查看全部 {count} 名学生',
      enterStudentNameOrNo: '输入学生姓名或学号',
      loadBusListFailed: '加载校车名单失败',
      updateBusStatusFailed: '更新校车状态失败',
      // 校车管理页面
      busStudentList: '校车学生名单',
      noStudents: '暂无学生',
      allCompleted: '全部完成',
      busListExportSuccess: '校车名单导出成功'
    },

    // 课后教师
    afterSchoolTeacher: {
      welcome: '欢迎回来',
      noClassAssigned: '未分配班级',
      contactAdminForClass: '请联系管理员分配班级',
      myClassOverview: '我的班级概览',
      myTotalStudents: '我的学生总数',
      pendingTasks: '待处理任务',
      studentsNotEntered: '有 {count} 名学生尚未进班',
      payAttentionToEntry: '请关注学生进班情况',
      departureTimeArrived: '下午离班时间已到',
      markDepartureStatus: '请及时标记学生离班状态',
      abnormalStudentsCount: '有 {count} 名学生状态异常',
      checkAbnormalSituation: '请检查并处理异常情况',
      studentManagementInDevelopment: '学生管理功能开发中',
      viewAbnormalStudentDetails: '查看异常学生详情',
      arrivalManagement: '进班管理',
      departureManagement: '离班管理',
      studentManagement: '学生管理',
      scanToEnterClass: '扫码进班',
      scanToLeaveClass: '扫码离班',
      enterClass: '进班',
      leaveClass: '离班',
      classEntry: '班级进入',
      classDeparture: '班级离开',
      enteredClass: '已进班',
      leftClass: '已离班',
      notEnteredClass: '未进班',
      inClass: '在班',
      studentEnteredClass: '学生已进班',
      studentLeftClass: '学生已离班',
      confirmLeaveClass: '确认离班',
      confirmLeaveClassMessage: '确定要标记学生 {name} 离班吗？',
      leaveClassSuccess: '离班标记成功',
      enterClassSuccess: '进班标记成功',
      operationFailed: '操作失败',
      noStudentsInClass: '班级中暂无学生',
      loadStudentsFailed: '加载学生列表失败',
      updateStatusFailed: '更新状态失败'
    }
    ,


    // 状态
    status: {
      active: '启用',
      inactive: '禁用',
      pending: '待处理',
      completed: '已完成',
      cancelled: '已取消'
    },
    
    // 管理员
    admin: {
      afterSchoolClassManagement: '课后托班管理',
      afterSchoolClassManagementDescription: '管理课后托班班级和教师分配',
      addAfterSchoolClass: '添加托班班级',
      editAfterSchoolClass: '编辑托班班级',
      afterSchoolClasses: '托班班级列表',
      selectTeacher: '选择托班教师',
      startTime: '开始时间',
      endTime: '结束时间',
      teacher: '教师',
      confirmDelete: '确认删除',
      deleteAfterSchoolClassConfirm: '确定要删除托班班级 {name} 吗？',
      classUpdated: '托班班级更新成功',
      classCreated: '托班班级创建成功',
      classDeleted: '托班班级删除成功',
      validation: {
        required: '此字段为必填项'
      }
    }
  },

  en: {
    // 通用
    common: {
      save: 'Save',
      cancel: 'Cancel',
      delete: 'Delete',
      edit: 'Edit',
      add: 'Add',
      search: 'Search',
      loading: 'Loading...',
      confirm: 'Confirm',
      yes: 'Yes',
      no: 'No',
      success: 'Success',
      error: 'Error',
      warning: 'Warning',
      info: 'Info',
      back: 'Back',
      next: 'Next',
      previous: 'Previous',
      submit: 'Submit',
      reset: 'Reset',
      close: 'Close',
      open: 'Open',
      view: 'View',
      download: 'Download',
      upload: 'Upload',
      export: 'Export',
      import: 'Import',
      refresh: 'Refresh',
      logout: 'Logout',
      profile: 'Profile',
      settings: 'Settings',
      schoolAttendanceSystem: 'School Attendance System',
      handle: 'Handle',
      loadDataFailed: 'Failed to load data',
      noData: 'No data available',
      name: 'Name',
      description: 'Description',
      fetchError: 'Failed to fetch data',
      saveError: 'Failed to save data',
      deleteError: 'Failed to delete data',
      actions: 'Actions'
    },

    // 登录
    auth: {
      login: 'Login',
      username: 'Username',
      password: 'Password',
      loginSuccess: 'Login successful',
      loginFailed: 'Login failed',
      usernameRequired: 'Username is required',
      passwordRequired: 'Password is required',
      invalidCredentials: 'Invalid username or password',
      changePassword: 'Change Password',
      currentPassword: 'Current Password',
      newPassword: 'New Password',
      confirmPassword: 'Confirm Password',
      passwordChanged: 'Password changed successfully'
    },

    // 导航
    nav: {
      dashboard: 'Dashboard',
      classManagement: 'Class Management',
      studentManagement: 'Student Management',
      teacherManagement: 'Teacher Management',
      userManagement: 'User Management',
      attendanceSettings: 'Attendance Settings',
      attendance: 'Attendance',
      reports: 'Reports',
      arrivalManagement: 'Arrival Management',
      departureManagement: 'Departure Management',
      busManagement: 'Bus Management',
      afterSchoolClassManagement: 'After School Class Management',

      afterSchoolArrivalManagement: 'Class Entry Management',
      afterSchoolDepartureManagement: 'Class Departure Management'
    },

    // 仪表盘
    dashboard: {
      totalStudents: 'Total Students',
      presentToday: 'Present Today',
      leaveToday: 'Leave Today',
      onLeave: 'On Leave',
      abnormal: 'Abnormal',
      abnormalToday: 'Abnormal Today',
      attendanceRate: 'Attendance Rate',
      classAttendance: 'Class Attendance',
      recentTrends: 'Recent Trends',
      abnormalStudents: 'Abnormal Students',
      arrivalAbnormalStudents: 'Arrival Abnormal Students',
      departureAbnormalStudents: 'Departure Abnormal Students',
      busStatistics: 'Bus Statistics',
      generateReport: 'Generate Report',
      dashboardDate: 'Dashboard Date',
      startDate: 'Report Start Date',
      endDate: 'Report End Date',
      headTeacher: 'Head Teacher',
      detailReport: 'Detail Report',
      viewDetail: 'View Detail',
      arrivalStatus: 'Arrival Status',
      arrivalTime: 'Arrival Time',
      departureStatus: 'Departure Status',
      departureTime: 'Departure Time',
      notes: 'Notes'
    },

    // 班级管理
    class: {
      className: 'Class Name',
      grade: 'Grade',
      description: 'Description',
      studentCount: 'Student Count',
      teachers: 'Teachers',
      addClass: 'Add Class',
      editClass: 'Edit Class',
      deleteClass: 'Delete Class',
      classCreated: 'Class created successfully',
      classUpdated: 'Class updated successfully',
      classDeleted: 'Class deleted successfully'
    },

    // 学生管理
    student: {
      studentNo: 'Student No.',
      studentName: 'Name',
      name: 'Name',
      qrCode: 'QR Code',
      parentName: 'Parent Name',
      parentPhone: 'Parent Phone',
      addStudent: 'Add Student',
      editStudent: 'Edit Student',
      deleteStudent: 'Delete Student',
      studentCreated: 'Student created successfully',
      studentUpdated: 'Student updated successfully',
      studentDeleted: 'Student deleted successfully',
      scanQRCode: 'Scan QR Code'
    },

    // 考勤管理
    attendance: {
      date: 'Date',
      arrivalStatus: 'Arrival Status',
      arrivalTime: 'Arrival Time',
      departureStatus: 'Departure Status',
      departureTime: 'Departure Time',
      notes: 'Notes',
      present: 'Present',
      leave: 'Leave',
      abnormal: 'Abnormal',
      notLeft: 'Not Left',
      bus: 'Bus',
      parentPickup: 'Parent Pickup',
      afterSchool: 'After School',
      specialCourse: 'Special Course',
      markArrival: 'Mark Arrival',
      markDeparture: 'Mark Departure',
      attendanceMarked: 'Attendance marked successfully'
    },

    // 用户管理
    user: {
      name: 'Name',
      role: 'Role',
      phone: 'Phone',
      email: 'Email',
      admin: 'Admin',
      teacher: 'Teacher',
      driver: 'Driver',
      addUser: 'Add User',
      editUser: 'Edit User',
      deleteUser: 'Delete User',
      userCreated: 'User created successfully',
      userUpdated: 'User updated successfully',
      userDeleted: 'User deleted successfully'
    },

    // 教师
    teacher: {
      welcome: 'Welcome back',
      noClassAssigned: 'No class assigned',
      contactAdminForClass: 'Please contact administrator to assign class',
      myClassOverview: 'My Class Overview',
      myTotalStudents: 'My Total Students',
      pendingTasks: 'Pending Tasks',
      studentsNotArrived: '{count} students have not arrived yet',
      payAttentionToArrival: 'Please pay attention to student arrival',
      departureTimeArrived: 'Afternoon departure time has arrived',
      markDepartureStatus: 'Please mark student departure status in time',
      abnormalStudentsCount: '{count} students have abnormal status',
      checkAbnormalSituation: 'Please check and handle abnormal situations',
      studentManagementInDevelopment: 'Student management feature is under development',
      viewAbnormalStudentDetails: 'View abnormal student details',
      dashboard: 'Teacher Dashboard',
      arrival_management: 'Arrival Management',
      departure_management: 'Departure Management',
      scan_qr: 'Scan QR Code',
      manual_input: 'Manual Input',
      student_arrived: 'Student Arrived',
      student_departed: 'Student Departed',
      mark_departure: 'Mark Departure',
      confirm_departure: 'Confirm Departure',
      set_abnormal: 'Set Abnormal',
      edit_notes: 'Edit Notes',
      quick_update: 'Quick Update',
      student_departure_management: 'Student Departure Management',
      search_student: 'Search Student',
      loading: 'Loading...',
      no_student_data: 'No Student Data',
      scan_student_qr: 'Scan Student QR Code',
      manual_input_code: 'Or manually enter student ID/QR code',
      time_restriction: 'Time Restriction',
      bus_pickup: 'Bus Pickup',
      parent_pickup: 'Parent Pickup',
      after_school: 'After School',
      special_course: 'Special Course',
      select_after_school_class: 'Select After School Class',
      please_select_class: 'Please select a class',
      student_notes: 'Student Notes',
      enter_notes: 'Please enter student notes...',
      confirm_student_departure: 'Confirm Student Departure',
      confirm_student_left_class: 'Confirm Student Left Class',
      mark_departure_status: 'Mark Departure Status',
      edit_student_notes: 'Edit Student Notes',
      marked_time: 'Marked Time',
      departure_update_success: 'Departure status updated successfully',
      departure_update_failed: 'Failed to update departure status',
      departure_confirm_success: 'Student departure confirmed successfully',
      departure_confirm_failed: 'Failed to confirm student departure',
      quick_mark_failed: 'Quick mark failed',
      mark_departure_failed: 'Failed to mark departure status',
      get_attendance_data_failed: 'Failed to get class attendance data',
      load_after_school_classes_failed: 'Failed to load after school classes',
      not_set: 'Not Set'
    },

    // 司机
    driver: {
      driverWorkstation: 'Driver Workstation',
      myBusInfo: 'My Bus Information',
      driverLicense: 'Driver License',
      busNumber: 'Bus Number',
      notSet: 'Not Set',
      notAssigned: 'Not Assigned',
      currentTime: 'Current Time',
      todayBusStudents: 'Today Bus Students',
      pending: 'Pending',
      quickOperation: 'Quick Operation',
      busManagement: 'Bus Management',
      personalSettings: 'Personal Settings',
      todayBusList: 'Today Bus List',
      noBusStudentsToday: 'No bus students today',
      departureMarkedByTeacher: 'Student departure status marked by teacher',
      viewAllStudents: 'View all {count} students',
      enterStudentNameOrNo: 'Enter student name or number',
      loadBusListFailed: 'Failed to load bus list',
      updateBusStatusFailed: 'Failed to update bus status',
      // Bus management page
      busStudentList: 'Bus Student List',
      noStudents: 'No Students',
      allCompleted: 'All Completed',
      busListExportSuccess: 'Bus list exported successfully'
    },

    // 课后教师
    afterSchoolTeacher: {
      welcome: 'Welcome back',
      noClassAssigned: 'No class assigned',
      contactAdminForClass: 'Please contact administrator to assign class',
      myClassOverview: 'My Class Overview',
      myTotalStudents: 'My Total Students',
      pendingTasks: 'Pending Tasks',
      studentsNotEntered: '{count} students have not entered class yet',
      payAttentionToEntry: 'Please pay attention to student class entry',
      departureTimeArrived: 'Afternoon departure time has arrived',
      markDepartureStatus: 'Please mark student departure status in time',
      abnormalStudentsCount: '{count} students have abnormal status',
      checkAbnormalSituation: 'Please check and handle abnormal situations',
      studentManagementInDevelopment: 'Student management feature is under development',
      viewAbnormalStudentDetails: 'View abnormal student details',
      arrivalManagement: 'Class Entry Management',
      departureManagement: 'Class Departure Management',
      studentManagement: 'Student Management',
      scanToEnterClass: 'Scan to Enter Class',
      scanToLeaveClass: 'Scan to Leave Class',
      enterClass: 'Enter Class',
      leaveClass: 'Leave Class',
      classEntry: 'Class Entry',
      classDeparture: 'Class Departure',
      enteredClass: 'Entered Class',
      leftClass: 'Left Class',
      notEnteredClass: 'Not Entered Class',
      inClass: 'In Class',
      studentEnteredClass: 'Student entered class',
      studentLeftClass: 'Student left class',
      confirmLeaveClass: 'Confirm Leave Class',
      confirmLeaveClassMessage: 'Are you sure you want to mark student {name} as left class?',
      leaveClassSuccess: 'Leave class marked successfully',
      enterClassSuccess: 'Enter class marked successfully',
      operationFailed: 'Operation failed',
      noStudentsInClass: 'No students in class currently',
      loadStudentsFailed: 'Failed to load student list',
      updateStatusFailed: 'Failed to update status'
    },

    // 状态
    status: {
      active: 'Active',
      inactive: 'Inactive',
      pending: 'Pending',
      completed: 'Completed',
      cancelled: 'Cancelled'
    },
    
    // 管理员
    admin: {
      afterSchoolClassManagement: 'After School Class Management',
      afterSchoolClassManagementDescription: 'Manage after school classes and teacher assignments',
      addAfterSchoolClass: 'Add After School Class',
      editAfterSchoolClass: 'Edit After School Class',
      afterSchoolClasses: 'After School Classes',
      selectTeacher: 'Select Teacher',
      startTime: 'Start Time',
      endTime: 'End Time',
      teacher: 'Teacher',
      confirmDelete: 'Confirm Delete',
      deleteAfterSchoolClassConfirm: 'Are you sure you want to delete the after school class {name}?',
      classUpdated: 'After school class updated successfully',
      classCreated: 'After school class created successfully',
      classDeleted: 'After school class deleted successfully',
      validation: {
        required: 'This field is required'
      }
    }
  }
}

const i18n = createI18n({
  legacy: false,
  locale: 'zh',
  fallbackLocale: 'en',
  messages
})

export default i18n
